{capture name="hidden"}	
	<input name="admin" type="hidden" value="1">
	<input name="module" type="hidden" value="shop">
	<input name="mod" type="hidden" value="product">
	<input name="act" type="hidden" value="add_group">
	<input name="name" type="hidden" value="{$smarty.get.name}">
	<input name="product_lang" type="hidden" value="{$smarty.get.lang}">
	<input name="parent" type="hidden" value="{$smarty.get.form}">
	<input type="hidden" name="group_parent" value="{$smarty.get.group}" />
{/capture}
{capture name="fields"}
<!-- * -->
{ext->class_function class="shop" func="get_all_product_groups" assign="groups_list"}
{ext->class_function class="shop" func="get_permisions_container" parent=$smarty.get.form name=$smarty.get.name lang=$smarty.get.lang group=$smarty.get.group assign="is_perm"}
{debug var=$permis_list}
{ext->aasort array=$groups_list args="+name" assign="groups_list2"}
{assign var="groups_list" value=$groups_list2}
<table width="100%" cellpadding="3" cellspacing="0">
	<tr>
		<td width="80" height="1"><img src="client/img/spacer.gif" class="spacer" alt="" /></td>
		<td><img src="client/img/spacer.gif" class="spacer" alt="" /></td>					
	</tr>
	<tr>
		<td>{t t='Grupė'}:</td>
		<td>
			<select name="group" style="border:1px solid #A8B3B8; width:100%;"  onChange="doTheFiltering(this,'group')">
				<option value="0" {if !$smarty.get.group}selected{/if}>{t t='Nepasirinkta'}</option>
				<option value="-1" {if $smarty.get.group=="-1"} selected{/if}>--- {t t='Išvalyti pasirinkima'} ---</option>
				{foreach from=$groups_list item="el"}
				{if $el.parent == 0}	
				<option value="{$el.id}"{if $smarty.get.group==$el.id} selected{/if}>{$el.name}</option>
				{/if}
				{/foreach}		
			</select>				
		</td>
	</tr>			
</table>	
{if ($smarty.get.group || $smarty.get.fresh_select && $smarty.get.group > 0) && ($smarty.get.group != "-1")}
	<table width="100%" cellpadding="3" cellspacing="0">
		<tr>
			<td width="80" height="1"><img src="client/img/spacer.gif" class="spacer" alt="" /></td>
			<td><img src="client/img/spacer.gif" class="spacer" alt="" /></td>					
		</tr>
		<tr>
			<td>{t t='Pogrupis'}:</td>
			<td>
				<select name="subgroup" style="border:1px solid #A8B3B8; width:100%;"  onChange="doTheFiltering(this,'subgroup')">
					<option value="0" {if !$smarty.get.subgroup}selected{/if}>{t t='Nepasirinkta'}</option>
					{foreach from=$groups_list item="el2" key="key2"}
						{if $el2.parent == $smarty.get.group}
							{capture name="keys"}{$el2.id}{/capture}{assign var="k" value=$smarty.capture.keys}
							<option value="{$el2.id}"{if $smarty.get.subgroup==$el2.id} selected{/if}>{$el2.name}</option>
						{/if}
					{/foreach}		
				</select>				
			</td>
		</tr>			
	</table>
	{if $smarty.get.subgroup && $smarty.get.subgroup>0}
		<table width="100%" cellpadding="0" cellspacing="0">
			<tr>
				<td height="20"><img src="client/img/spacer.gif" width="1" height="1" border="0" alt="" /></td>
			</tr>
			<tr>
				<td>
					{ext->class_function class="shop" func="get_all_products_by_group_name_only" curent_page=-1 group_id=$smarty.get.subgroup hide=1 assign="products_list"}
					{foreach from=$products_list key="key2" item="el2"}
					{if $key2 != 'pages'}
					<!-- * -->
					<table width="100%" cellpadding="0" cellspacing="0">
						<tr>
							<td height="1" bgcolor="#FFFFFF"><img src="client/img/spacer.gif" class="spacer" alt="" /></td>
						</tr>
					</table>
					<table cellpadding="0" cellspacing="0"  >
						<tr>	
							{*ext->class_function class="shop" func="get_permisions_container" parent=$smarty.get.form name=$smarty.get.name assign="is_perm"*}
							<td width="1" height="25"><input type="checkbox" name="products[{$key2}]" {if $is_perm.$key2 == "on"}checked{/if}></td>
							<td width="5"><img src="client/img/spacer.gif" class="spacer" alt="" /></td>
							<td >{$el2.name}</td>			
						</tr>
					</table>
					<table width="100%" cellpadding="0" cellspacing="0">
						<tr>
							<td height="1" bgcolor="#D6DBDE"><img src="client/img/spacer.gif" class="spacer" alt="" /></td>
						</tr>
					</table>
					<!-- /* -->
					{/if}
					{/foreach}
				</td>		
			</tr>
		</table>
	{/if}
{elseif $smarty.get.group == "-1"}
<table width="100%" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
	<tr>
		<td width="10"><img src="client/img/spacer.gif" width="1" height="1" border="0" alt="" /></td>
		<td height="30" bgcolor="#FFFFFF">{t t='Bus išvalyti visi pasirinkimai!'}</td>		
	</tr>
</table>
{else}
<table width="100%" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
	<tr>
		<td width="10"><img src="client/img/spacer.gif" width="1" height="1" border="0" alt="" /></td>
		<td height="30" bgcolor="#FFFFFF">{t t='Pasirinkite grupę'} {t t='arba'} {t t='Išvalyti pasirinkimą'}</td>		
	</tr>
</table>
{/if}
<!-- /* -->
{/capture}



